/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DbexConnectionDialog.java
 *
 * Created on 9 Jul, 2010, 11:53:37 AM
 */

package com.gs.mockup.dbex;

import java.awt.event.ActionListener;
import java.awt.event.KeyListener;
import java.awt.event.WindowListener;
import java.beans.PropertyChangeListener;
import javax.swing.event.ListSelectionListener;

/**
 *
 * @author sabuj.das
 */
public class DbexConnectionDialog extends javax.swing.JDialog implements ActionListener, ListSelectionListener, PropertyChangeListener, KeyListener, WindowListener {

    /** Creates new form DbexConnectionDialog */
    public DbexConnectionDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        connectionNameList = new javax.swing.JList();
        actionToolBar = new javax.swing.JToolBar();
        newConnectionButton = new javax.swing.JButton();
        loadConnectionsButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        saveButton = new javax.swing.JButton();
        saveAsButton = new javax.swing.JButton();
        saveAllButton = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        clearButton = new javax.swing.JButton();
        deleteButton = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        exportAllButton = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        connectionNameLabel = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        dbTypeComboBox = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        driverClassTextField = new javax.swing.JTextField();
        driverMgrButton = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JSeparator();
        fieldValuePanel = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        hostNameTextField = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        portNumberFormattedTextField = new javax.swing.JFormattedTextField();
        jLabel8 = new javax.swing.JLabel();
        userNameTextField = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        passwordPasswordField = new javax.swing.JPasswordField();
        savePasswordCheckBox = new javax.swing.JCheckBox();
        schemaLabel = new javax.swing.JLabel();
        schemaNameTextField = new javax.swing.JTextField();
        sidLabel = new javax.swing.JLabel();
        sidTextField = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        schemaRadioButton = new javax.swing.JRadioButton();
        catalogRadioButton = new javax.swing.JRadioButton();
        jLabel13 = new javax.swing.JLabel();
        jSeparator5 = new javax.swing.JSeparator();
        jLabel6 = new javax.swing.JLabel();
        urlTextField = new javax.swing.JTextField();
        editUrlToggleButton = new javax.swing.JToggleButton();
        moveUpButton = new javax.swing.JButton();
        moveDownButton = new javax.swing.JButton();
        cancelButton = new javax.swing.JButton();
        testConnectionButton = new javax.swing.JButton();
        connectButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(this);

        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setLayout(new java.awt.GridBagLayout());

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 16));
        jLabel1.setForeground(new java.awt.Color(0, 51, 255));
        jLabel1.setText("Connection Names");
        jLabel1.setName("jLabel1"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(jLabel1, gridBagConstraints);

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        connectionNameList.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        connectionNameList.setName("connectionNameList"); // NOI18N
        connectionNameList.addListSelectionListener(this);
        connectionNameList.addPropertyChangeListener(this);
        jScrollPane1.setViewportView(connectionNameList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(jScrollPane1, gridBagConstraints);

        actionToolBar.setFloatable(false);
        actionToolBar.setRollover(true);
        actionToolBar.setName("actionToolBar"); // NOI18N

        newConnectionButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/new_connection.gif"))); // NOI18N
        newConnectionButton.setToolTipText("New Connection");
        newConnectionButton.setFocusable(false);
        newConnectionButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        newConnectionButton.setName("newConnectionButton"); // NOI18N
        newConnectionButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        newConnectionButton.addActionListener(this);
        actionToolBar.add(newConnectionButton);

        loadConnectionsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/go-bottom.png"))); // NOI18N
        loadConnectionsButton.setToolTipText("Load Connections");
        loadConnectionsButton.setFocusable(false);
        loadConnectionsButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        loadConnectionsButton.setName("loadConnectionsButton"); // NOI18N
        loadConnectionsButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        loadConnectionsButton.addActionListener(this);
        actionToolBar.add(loadConnectionsButton);

        jSeparator1.setName("jSeparator1"); // NOI18N
        actionToolBar.add(jSeparator1);

        saveButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/save_edit.gif"))); // NOI18N
        saveButton.setToolTipText("Save");
        saveButton.setFocusable(false);
        saveButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        saveButton.setName("saveButton"); // NOI18N
        saveButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        saveButton.addActionListener(this);
        actionToolBar.add(saveButton);

        saveAsButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/saveas_edit.gif"))); // NOI18N
        saveAsButton.setToolTipText("Save As...");
        saveAsButton.setFocusable(false);
        saveAsButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        saveAsButton.setName("saveAsButton"); // NOI18N
        saveAsButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        saveAsButton.addActionListener(this);
        actionToolBar.add(saveAsButton);

        saveAllButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/saveall_edit.gif"))); // NOI18N
        saveAllButton.setToolTipText("Save All...");
        saveAllButton.setFocusable(false);
        saveAllButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        saveAllButton.setName("saveAllButton"); // NOI18N
        saveAllButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        saveAllButton.addActionListener(this);
        actionToolBar.add(saveAllButton);

        jSeparator2.setName("jSeparator2"); // NOI18N
        actionToolBar.add(jSeparator2);

        clearButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/edit-clear.png"))); // NOI18N
        clearButton.setToolTipText("Clear");
        clearButton.setFocusable(false);
        clearButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        clearButton.setName("clearButton"); // NOI18N
        clearButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        clearButton.addActionListener(this);
        actionToolBar.add(clearButton);

        deleteButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/delete_edit.gif"))); // NOI18N
        deleteButton.setToolTipText("Delete");
        deleteButton.setFocusable(false);
        deleteButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        deleteButton.setName("deleteButton"); // NOI18N
        deleteButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        deleteButton.addActionListener(this);
        actionToolBar.add(deleteButton);

        jSeparator3.setName("jSeparator3"); // NOI18N
        actionToolBar.add(jSeparator3);

        exportAllButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/export_wiz.gif"))); // NOI18N
        exportAllButton.setToolTipText("Export All to XML");
        exportAllButton.setFocusable(false);
        exportAllButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        exportAllButton.setName("exportAllButton"); // NOI18N
        exportAllButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        exportAllButton.addActionListener(this);
        actionToolBar.add(exportAllButton);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(actionToolBar, gridBagConstraints);

        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setLayout(new java.awt.GridBagLayout());

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel2.setForeground(new java.awt.Color(0, 51, 204));
        jLabel2.setText("Connection Details  ");
        jLabel2.setName("jLabel2"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(jLabel2, gridBagConstraints);

        connectionNameLabel.setText("${connName}");
        connectionNameLabel.setName("connectionNameLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(connectionNameLabel, gridBagConstraints);

        jLabel4.setText("Database Type");
        jLabel4.setName("jLabel4"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(jLabel4, gridBagConstraints);

        dbTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        dbTypeComboBox.setName("dbTypeComboBox"); // NOI18N
        dbTypeComboBox.addPropertyChangeListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(dbTypeComboBox, gridBagConstraints);

        jLabel5.setText("Driver Class Name");
        jLabel5.setName("jLabel5"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(jLabel5, gridBagConstraints);

        driverClassTextField.setName("driverClassTextField"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(driverClassTextField, gridBagConstraints);

        driverMgrButton.setText("Driver Mgr...");
        driverMgrButton.setName("driverMgrButton"); // NOI18N
        driverMgrButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(driverMgrButton, gridBagConstraints);

        jSeparator4.setName("jSeparator4"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0);
        jPanel2.add(jSeparator4, gridBagConstraints);

        fieldValuePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, " Field Values ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 11), new java.awt.Color(102, 102, 255))); // NOI18N
        fieldValuePanel.setName("fieldValuePanel"); // NOI18N
        fieldValuePanel.setLayout(new java.awt.GridBagLayout());

        jLabel3.setText("Host Name");
        jLabel3.setName("jLabel3"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(jLabel3, gridBagConstraints);

        hostNameTextField.setName("hostNameTextField"); // NOI18N
        hostNameTextField.addKeyListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(hostNameTextField, gridBagConstraints);

        jLabel7.setText("Port Number");
        jLabel7.setName("jLabel7"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(jLabel7, gridBagConstraints);

        portNumberFormattedTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("###0"))));
        portNumberFormattedTextField.setName("portNumberFormattedTextField"); // NOI18N
        portNumberFormattedTextField.addKeyListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(portNumberFormattedTextField, gridBagConstraints);

        jLabel8.setText("User Name");
        jLabel8.setName("jLabel8"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(jLabel8, gridBagConstraints);

        userNameTextField.setName("userNameTextField"); // NOI18N
        userNameTextField.addKeyListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(userNameTextField, gridBagConstraints);

        jLabel9.setText("Password");
        jLabel9.setName("jLabel9"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(jLabel9, gridBagConstraints);

        passwordPasswordField.setName("passwordPasswordField"); // NOI18N
        passwordPasswordField.addKeyListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(passwordPasswordField, gridBagConstraints);

        savePasswordCheckBox.setText("Save Password");
        savePasswordCheckBox.setName("savePasswordCheckBox"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(savePasswordCheckBox, gridBagConstraints);

        schemaLabel.setText("Schema");
        schemaLabel.setName("schemaLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(schemaLabel, gridBagConstraints);

        schemaNameTextField.setName("schemaNameTextField"); // NOI18N
        schemaNameTextField.addKeyListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(schemaNameTextField, gridBagConstraints);

        sidLabel.setText("SID/Service Name");
        sidLabel.setName("sidLabel"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(sidLabel, gridBagConstraints);

        sidTextField.setName("sidTextField"); // NOI18N
        sidTextField.addKeyListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(sidTextField, gridBagConstraints);

        jLabel12.setText("Storage Type");
        jLabel12.setName("jLabel12"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(jLabel12, gridBagConstraints);

        buttonGroup1.add(schemaRadioButton);
        schemaRadioButton.setSelected(true);
        schemaRadioButton.setText("SCHEMA");
        schemaRadioButton.setName("schemaRadioButton"); // NOI18N
        schemaRadioButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(schemaRadioButton, gridBagConstraints);

        buttonGroup1.add(catalogRadioButton);
        catalogRadioButton.setText("CATALOG");
        catalogRadioButton.setName("catalogRadioButton"); // NOI18N
        catalogRadioButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        fieldValuePanel.add(catalogRadioButton, gridBagConstraints);

        jLabel13.setName("jLabel13"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.gridwidth = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        fieldValuePanel.add(jLabel13, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(fieldValuePanel, gridBagConstraints);

        jSeparator5.setName("jSeparator5"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 6;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 0, 2, 0);
        jPanel2.add(jSeparator5, gridBagConstraints);

        jLabel6.setText("Connection URL");
        jLabel6.setName("jLabel6"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 7;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(jLabel6, gridBagConstraints);

        urlTextField.setEditable(false);
        urlTextField.setName("urlTextField"); // NOI18N
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 7;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(urlTextField, gridBagConstraints);

        editUrlToggleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/edit.gif"))); // NOI18N
        editUrlToggleButton.setText("Edit");
        editUrlToggleButton.setName("editUrlToggleButton"); // NOI18N
        editUrlToggleButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 7;
        gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
        jPanel2.add(editUrlToggleButton, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.gridheight = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(jPanel2, gridBagConstraints);

        moveUpButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Stock Index Up.png"))); // NOI18N
        moveUpButton.setName("moveUpButton"); // NOI18N
        moveUpButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(moveUpButton, gridBagConstraints);

        moveDownButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/go-down.png"))); // NOI18N
        moveDownButton.setName("moveDownButton"); // NOI18N
        moveDownButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(moveDownButton, gridBagConstraints);

        cancelButton.setText("Cancel");
        cancelButton.setName("cancelButton"); // NOI18N
        cancelButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(cancelButton, gridBagConstraints);

        testConnectionButton.setText("Test Connection");
        testConnectionButton.setName("testConnectionButton"); // NOI18N
        testConnectionButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 3;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(testConnectionButton, gridBagConstraints);

        connectButton.setText("Connect");
        connectButton.setName("connectButton"); // NOI18N
        connectButton.addActionListener(this);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 4;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST;
        gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
        jPanel1.add(connectButton, gridBagConstraints);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        pack();
    }

    // Code for dispatching events from components to event handlers.

    public void actionPerformed(java.awt.event.ActionEvent evt) {
        if (evt.getSource() == newConnectionButton) {
            DbexConnectionDialog.this.newConnectionButtonActionPerformed(evt);
        }
        else if (evt.getSource() == loadConnectionsButton) {
            DbexConnectionDialog.this.loadConnectionsButtonActionPerformed(evt);
        }
        else if (evt.getSource() == saveButton) {
            DbexConnectionDialog.this.saveButtonActionPerformed(evt);
        }
        else if (evt.getSource() == saveAsButton) {
            DbexConnectionDialog.this.saveAsButtonActionPerformed(evt);
        }
        else if (evt.getSource() == saveAllButton) {
            DbexConnectionDialog.this.saveAllButtonActionPerformed(evt);
        }
        else if (evt.getSource() == deleteButton) {
            DbexConnectionDialog.this.deleteButtonActionPerformed(evt);
        }
        else if (evt.getSource() == clearButton) {
            DbexConnectionDialog.this.clearButtonActionPerformed(evt);
        }
        else if (evt.getSource() == exportAllButton) {
            DbexConnectionDialog.this.exportAllButtonActionPerformed(evt);
        }
        else if (evt.getSource() == driverMgrButton) {
            DbexConnectionDialog.this.driverMgrButtonActionPerformed(evt);
        }
        else if (evt.getSource() == schemaRadioButton) {
            DbexConnectionDialog.this.schemaRadioButtonActionPerformed(evt);
        }
        else if (evt.getSource() == catalogRadioButton) {
            DbexConnectionDialog.this.catalogRadioButtonActionPerformed(evt);
        }
        else if (evt.getSource() == editUrlToggleButton) {
            DbexConnectionDialog.this.editUrlToggleButtonActionPerformed(evt);
        }
        else if (evt.getSource() == moveUpButton) {
            DbexConnectionDialog.this.moveUpButtonActionPerformed(evt);
        }
        else if (evt.getSource() == moveDownButton) {
            DbexConnectionDialog.this.moveDownButtonActionPerformed(evt);
        }
        else if (evt.getSource() == cancelButton) {
            DbexConnectionDialog.this.cancelButtonActionPerformed(evt);
        }
        else if (evt.getSource() == testConnectionButton) {
            DbexConnectionDialog.this.testConnectionButtonActionPerformed(evt);
        }
        else if (evt.getSource() == connectButton) {
            DbexConnectionDialog.this.connectButtonActionPerformed(evt);
        }
    }

    public void keyPressed(java.awt.event.KeyEvent evt) {
    }

    public void keyReleased(java.awt.event.KeyEvent evt) {
        if (evt.getSource() == hostNameTextField) {
            DbexConnectionDialog.this.hostNameTextFieldKeyReleased(evt);
        }
        else if (evt.getSource() == portNumberFormattedTextField) {
            DbexConnectionDialog.this.portNumberFormattedTextFieldKeyReleased(evt);
        }
        else if (evt.getSource() == userNameTextField) {
            DbexConnectionDialog.this.userNameTextFieldKeyReleased(evt);
        }
        else if (evt.getSource() == passwordPasswordField) {
            DbexConnectionDialog.this.passwordPasswordFieldKeyReleased(evt);
        }
        else if (evt.getSource() == schemaNameTextField) {
            DbexConnectionDialog.this.schemaNameTextFieldKeyReleased(evt);
        }
        else if (evt.getSource() == sidTextField) {
            DbexConnectionDialog.this.sidTextFieldKeyReleased(evt);
        }
    }

    public void keyTyped(java.awt.event.KeyEvent evt) {
    }

    public void windowActivated(java.awt.event.WindowEvent evt) {
    }

    public void windowClosed(java.awt.event.WindowEvent evt) {
    }

    public void windowClosing(java.awt.event.WindowEvent evt) {
        if (evt.getSource() == DbexConnectionDialog.this) {
            DbexConnectionDialog.this.formWindowClosing(evt);
        }
    }

    public void windowDeactivated(java.awt.event.WindowEvent evt) {
    }

    public void windowDeiconified(java.awt.event.WindowEvent evt) {
    }

    public void windowIconified(java.awt.event.WindowEvent evt) {
    }

    public void windowOpened(java.awt.event.WindowEvent evt) {
    }

    public void propertyChange(java.beans.PropertyChangeEvent evt) {
        if (evt.getSource() == connectionNameList) {
            DbexConnectionDialog.this.connectionNameListPropertyChange(evt);
        }
        else if (evt.getSource() == dbTypeComboBox) {
            DbexConnectionDialog.this.dbTypeComboBoxPropertyChange(evt);
        }
    }

    public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
        if (evt.getSource() == connectionNameList) {
            DbexConnectionDialog.this.connectionNameListValueChanged(evt);
        }
    }// </editor-fold>//GEN-END:initComponents

	private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_cancelButtonActionPerformed

	private void connectionNameListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_connectionNameListValueChanged
		// TODO add your handling code here:
	}//GEN-LAST:event_connectionNameListValueChanged

	private void connectionNameListPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_connectionNameListPropertyChange
		// TODO add your handling code here:
	}//GEN-LAST:event_connectionNameListPropertyChange

	private void newConnectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newConnectionButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_newConnectionButtonActionPerformed

	private void loadConnectionsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadConnectionsButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_loadConnectionsButtonActionPerformed

	private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_saveButtonActionPerformed

	private void saveAsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAsButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_saveAsButtonActionPerformed

	private void saveAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveAllButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_saveAllButtonActionPerformed

	private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_deleteButtonActionPerformed

	private void clearButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_clearButtonActionPerformed

	private void exportAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exportAllButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_exportAllButtonActionPerformed

	private void dbTypeComboBoxPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_dbTypeComboBoxPropertyChange
		// TODO add your handling code here:
	}//GEN-LAST:event_dbTypeComboBoxPropertyChange

	private void driverMgrButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_driverMgrButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_driverMgrButtonActionPerformed

	private void moveUpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveUpButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_moveUpButtonActionPerformed

	private void moveDownButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveDownButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_moveDownButtonActionPerformed

	private void editUrlToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editUrlToggleButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_editUrlToggleButtonActionPerformed

	private void testConnectionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_testConnectionButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_testConnectionButtonActionPerformed

	private void connectButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_connectButtonActionPerformed

	private void schemaRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_schemaRadioButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_schemaRadioButtonActionPerformed

	private void catalogRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_catalogRadioButtonActionPerformed
		// TODO add your handling code here:
	}//GEN-LAST:event_catalogRadioButtonActionPerformed

	private void hostNameTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_hostNameTextFieldKeyReleased
		// TODO add your handling code here:
	}//GEN-LAST:event_hostNameTextFieldKeyReleased

	private void portNumberFormattedTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_portNumberFormattedTextFieldKeyReleased
		// TODO add your handling code here:
	}//GEN-LAST:event_portNumberFormattedTextFieldKeyReleased

	private void userNameTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_userNameTextFieldKeyReleased
		// TODO add your handling code here:
	}//GEN-LAST:event_userNameTextFieldKeyReleased

	private void passwordPasswordFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordPasswordFieldKeyReleased
		// TODO add your handling code here:
	}//GEN-LAST:event_passwordPasswordFieldKeyReleased

	private void schemaNameTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_schemaNameTextFieldKeyReleased
		// TODO add your handling code here:
	}//GEN-LAST:event_schemaNameTextFieldKeyReleased

	private void sidTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_sidTextFieldKeyReleased
		urlTextField.setText(sidTextField.getText());
	}//GEN-LAST:event_sidTextFieldKeyReleased

	private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
		// TODO add your handling code here:
	}//GEN-LAST:event_formWindowClosing

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                DbexConnectionDialog dialog = new DbexConnectionDialog(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JToolBar actionToolBar;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JButton cancelButton;
    private javax.swing.JRadioButton catalogRadioButton;
    private javax.swing.JButton clearButton;
    private javax.swing.JButton connectButton;
    private javax.swing.JLabel connectionNameLabel;
    private javax.swing.JList connectionNameList;
    private javax.swing.JComboBox dbTypeComboBox;
    private javax.swing.JButton deleteButton;
    private javax.swing.JTextField driverClassTextField;
    private javax.swing.JButton driverMgrButton;
    private javax.swing.JToggleButton editUrlToggleButton;
    private javax.swing.JButton exportAllButton;
    private javax.swing.JPanel fieldValuePanel;
    private javax.swing.JTextField hostNameTextField;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JSeparator jSeparator4;
    private javax.swing.JSeparator jSeparator5;
    private javax.swing.JButton loadConnectionsButton;
    private javax.swing.JButton moveDownButton;
    private javax.swing.JButton moveUpButton;
    private javax.swing.JButton newConnectionButton;
    private javax.swing.JPasswordField passwordPasswordField;
    private javax.swing.JFormattedTextField portNumberFormattedTextField;
    private javax.swing.JButton saveAllButton;
    private javax.swing.JButton saveAsButton;
    private javax.swing.JButton saveButton;
    private javax.swing.JCheckBox savePasswordCheckBox;
    private javax.swing.JLabel schemaLabel;
    private javax.swing.JTextField schemaNameTextField;
    private javax.swing.JRadioButton schemaRadioButton;
    private javax.swing.JLabel sidLabel;
    private javax.swing.JTextField sidTextField;
    private javax.swing.JButton testConnectionButton;
    private javax.swing.JTextField urlTextField;
    private javax.swing.JTextField userNameTextField;
    // End of variables declaration//GEN-END:variables

}
